/*
 * Title: 竖式问题(abc*de)
 * Author: Yuanshun L
 * Created: 28-Sep-2021
 */
#include<stdio.h>
#include<string.h>
char s[20];
char buf[99];
int main() {
    int solution_num = 0;
    scanf("%s",s);
    for(int i=100;i<=999;i++){
        for(int j=10;j<=99;j++){
            sprintf(buf,"%d%d%d%d%d",i,j,i*(j%10),i*(j/10),i*j);
            int ok=1;
            for(int k=0;k<strlen(buf);k++){
                if(strchr(s,buf[k]) == NULL){
                    ok=0;break;
                }
            }
            // print the solution
            if(ok){
                solution_num++;
                printf("<%d>\n",solution_num);
                printf("%5d\nX%4d\n-----\n%5d\n%4d\n-----\n%5d\n",i,j,i*(j%10),i*(j/10),i*j);
            }
        }
    }
    printf("\nThe number of solutions = %d",solution_num);
    return 0;
}
